package world.snowcrystal.openapi.job;


import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import world.snowcrystal.commons.model.entity.DailyInvokeLog;
import world.snowcrystal.openapi.mapper.DailyInvokeLogMapper;

@Component
@Slf4j
public class CreateInvokeCountLog {

    @Resource
    private DailyInvokeLogMapper dailyInvokeLogMapper;

    @Scheduled(cron = "0 0 0 */1 * ? ")
    public void createInvokeCountLog() {
        // 每天凌晨创建一条新的记录
        log.info("createInvokeCountLog start");
        DailyInvokeLog dailyInvokeLog = new DailyInvokeLog();
        boolean success = dailyInvokeLogMapper.insertOrUpdate(dailyInvokeLog);
        log.info("createInvokeCountLog end : {}", success);

    }


}
